import React, { PureComponent } from 'react';
import { Modal, List, InputItem, WhiteSpace, Button, WingBlank, Menu, ActivityIndicator, SearchBar, Accordion } from 'antd-mobile';
import { connect } from 'dva';
import ast from './index.less';
import { setCookie } from '../../utils/auth'
import { createForm, formShape } from 'rc-form';
import { Divider, Table } from 'antd';
const PlaceHolder = ({ className = '', ...restProps }) => (
  <div className={`${className} placeholder`} {...restProps}>Block</div>
);
class DegreeInformation extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      initData: '',
      show: false,
      selectedTab: 'redTab',
      hidden: false,
      fullScreen: false
    };
  }
  onChange = (key) => {
    if(key){
      this.props.dispatch({ type: "degreeInformationModule/loadInfoStutrain", payload: {
        id:this.props.timetable[key].stuId,
        uniqueId:this.props.timetable[key].majorUniqueId,
        types:{
          stuId:this.props.timetable[key].stuId,
          type:1
        }
    } })
    this.props.dispatch({ type: "degreeInformationModule/loadAlDegreegradu", payload: {
    } })
    this.props.dispatch({ type: "degreeInformationModule/loadAlDe", payload: {
      
    } })
    }
  }
  componentWillMount() {
    this.props.dispatch({ type: "degreeInformationModule/tutorVerify", payload: {
      rows:100,
      type:1,
      order:'asc',
      page:1
    } })
    this.props.dispatch({ type: "degreeInformationModule/loadSysParamList", payload: {
      code:"code=current_school_code"
    } })

}
  handleClick = (e) => {
    e.preventDefault(); // Fix event propagation on Android
    this.setState({
      show: !this.state.show,
    });
  }

  onMaskClick = () => {
    this.setState({
      show: false,
    });
  }

  render() {
    const { initData, show } = this.state;
    const loadingEl = (
      <div style={{ width: '100%', height: document.documentElement.clientHeight * 0.6, display: 'flex', justifyContent: 'center' }}>
        <ActivityIndicator size="large" />
      </div>
    );
    return (
      <div className={show ? ast.menu_active : ''}>
        <SearchBar placeholder="请输入课程名称" ref={ref => this.autoFocusInst = ref} />
        <WhiteSpace />
        <Accordion accordion className={ast.my_accordion} onChange={this.onChange.bind(this)}>
                {this.props.timetable.length == 0 ? null :
                      this.props.timetable.map((s,key) => {
                        return (<Accordion.Panel key={key} className={ast.Panel} header={
                          <div className={ast.Panel_title}>
                            <img src={require('../../assets/icon_08.png')} style={{ padding: '10px' }} />
                              
                            <p >{`学生姓名：${s.perName}`}</p>
                            <p style={{ color:'#747474',marginLeft:'30px' }}>{s.isTrueGraduateInfo == 1 ? '已确认' : '未确认'}</p>
                          </div>
                        }>
                        {this.props.loadAlDeList == undefined ? null : <ul>
                            <li>{`性别：${this.props.loadAlDeList.genderCode == 1 ? '男' : '女'}`}</li>
                            <li>{`入学年月：${this.props.loadAlDeList.entrYearMon}`}</li>
                            <li>{`专业：${this.props.loadAlDeList.name}`}</li>
                            <li>{`毕业年月：${this.props.loadAlDeList.graduateDate}`}</li>
                            <li>{`毕业证书号：${this.props.loadAlDeList.certificateNum}`}</li>
                          </ul>}
                          
                        </Accordion.Panel>)
                      })
                    }
          
          
        </Accordion>
      </div>

    );
  }
}
function mapStateToProps(state) {
  return {
    timetable: state.degreeInformationModule.tutorVerifyList,
    stuInformation:state.degreeInformationModule.data,
    marjor:state.degreeInformationModule.loadAlDegreegraduList.data,
    loadAlDeList:state.degreeInformationModule.loadAlDeList
  }
}
export default connect(mapStateToProps)(DegreeInformation);
